Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Improve URL query parameter handling for correct concatenat… #1820

Closed
wants to merge 2 commits into from

Conversation

amoycode
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[x ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

The current URL handling does not correctly concatenate query parameters if the URL already contains existing parameters.
exp:

in app.config.ts:
"lodop": {
    "companyName": "xxxxxx",
    "url": "https://print.xxx.com:8443/CLodopfuncs.js?AOListCount=500"
}

lodop.service.ts#request:
https://print.xxx.com:8443/CLodopfuncs.js?AOListCount=100?name=CLodop

What is the new behavior?

The URL handling has been refactored to correctly concatenate query parameters even if the URL already contains existing parameters. The new implementation also ensures proper encoding of the query parameters.
exp:
https://print.xxx.com:8443/CLodopfuncs.js?AOListCount=100&name=CLodop

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@@ -86,10 +86,18 @@ export class LodopService implements OnDestroy {
if (!this._lodop) throw new Error(`请务必先调用 lodop 获取对象`);
}

private requestUrl(): string {
const urlObj = new URL(this.cog.url!);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL 看起来无法通过 Test

@amoycode amoycode closed this Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants